package com.example.eurekacustomer.controller;

import com.example.eurekacustomer.service.FeignService;
import com.example.eurekacustomer.service.OutUrlFeignService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Auther: zyb
 * @Date: 2018/11/7 11:28
 * @Description: Feign方式调用服务
 */

@RestController
@RequestMapping("/feign")
public class FeignController {

    @Resource
    private FeignService feignService;

    @Resource
    private OutUrlFeignService outUrlFeignService;

    @GetMapping("/indexForFeign")
    String index() {
        return feignService.index();
    }

    @GetMapping("/getUserNameForFeign")
    String getUserName(@RequestParam("name") String name) {
        return feignService.getUserName(name);
    }

    @GetMapping("/getUserInfoForFeign")
    String getUserInfo(@RequestParam("name") String name, @RequestParam("password") String password) {
        return feignService.getUserInfo(name, password);
    }

    @PostMapping("/putUserNameForFeign")
    String putUserName(@RequestParam("name") String name, @RequestParam("password") String password) {
        return feignService.putUserName(name, password);
    }

    @GetMapping("/getBaidu")
    String getBaidu() {
        return outUrlFeignService.index();
    }
}
